home *** CD-ROM | disk | FTP | other *** search
- Path: news.lpr.carel.fi!usenet
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.lang.c
- Subject: Re: a pointer problem
- Date: Fri, 02 Feb 1996 14:59:35 +0200
- Organization: Carelcomp Forest
- Message-ID: <31120AB7.1C44@cmt.lpr.mail.carel.fi>
- References: <4errk0$4c3@srvr1.engin.umich.edu>
- NNTP-Posting-Host: renoir.cclahti.carel.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (WinNT; I)
-
- Chih-Jen Lin wrote:
- >
- > Hi,
- >
- > This is an old problem of C. I remember a pointer may point
- > to any one address when it's declaired. Is there any way to
- > avoid this problem in ANSI C ? Or how can I let a variable be
- > NULL while it's declaired ?
- >
- > Thanks in advance.
- >
- > Chih-Jen Lin
-
- You'll have to explicitly initialize the pointer, ANSI C (or any other standard)
- doesn't do it for you. However, most compilers tend to initialize variables (also
- pointers) declared outside of any function scope (or 'static' variables inside
- functions) to zero/NULL, but I wouldn't count on it.
-
- Later,
- AriL
- --
- All my opinions are mine and mine alone.
-